<template>
	<view style="padding: 40px 20px 0 20px;">
		<view :class="[isShow ? 'height-all' : 'height-init']" class="table-content">
			<view v-for="(item, index) in tableList" class="table-chart" :key="index">
				<view class="table-header">
					<text class="text-middle">时间</text>
					<view v-for="(item1, index1) in item.dateArray" :key="index1" class="text-middle">{{ item1 }}</view>
				</view>
				<view class="table-header white">
					<text class="text-middle">压力</text>
					<view v-for="(item1, index1) in item.dataArray" :key="index1" class="text-middle">{{ item1 }}</view>
				</view>
			</view>
		</view>
		<view @click="isShow = !isShow" class="text-operation">
			<view style="margin: auto; display: flex; align-items: center">
				<view class="img-down"></view>
				<view>{{ isShow ? '收起' : '展开查看全部' }}</view>
			</view>
		</view>
	</view>
</template>

<script>
export default {
	data() {
		return {
			isShow: false,
			tableList: []
		}
	},
	methods: {
		init(data) {
			console.log(data, 'dddddd');
			this.tableList = data || []
		}
	}
};
</script>

<style lang="scss" scoped>
.text-operation {
	display: flex;
	align-items: center;
	color: #2f80ed;
	font-weight: 500;
	font-size: 16px;
	padding: 20px 0;
	.img-down {
		height: 20px;
		width: 20px;
		background: url('@/subpackage-overhaul/static/down.png') no-repeat 100% 100%;
		margin-right: 5px;
	}
}
.table-content {
	overflow-y: hidden;
}
.height-all {
	max-height: initial; //这是啥意思  回到初始化的状态
}
.height-init {
	max-height: 146px;
}
.table-chart {
	// width: 100vw;
	box-sizing: border-box;
	color: #000000;
	font-weight: bold;
	font-size: 16px;
	line-height: 22px;
	background-color: #F5F7FA;
	// border: 5px solid #fff;
	overflow: auto;
	.table-header {
		height: 50px;
		display: flex;
		text-align: center;
		flex-wrap: nowrap;
		position: sticky;
		top: 0;
		z-index: 2;
		&.white {
			background-color: white;
			color: #445469;
		}
		> view {
			flex-shrink: 0;
		}
	}

	.text-middle {
		display: flex;
		justify-content: center;
		align-items: center;
		flex-direction: column;
		width: 55px;
		> text {
			padding: 0 8px;
		}
	}
	.table-body {
		.table-body-item {
			display: flex;
			align-items: stretch;
			text-align: center;
			flex-wrap: nowrap;
			line-height: 27px;
			> view {
				border-bottom: 2px solid #fff;
			}
			.table-body-text {
				font-size: 14px;
				font-weight: 500;
				color: #475560;
				background: #f1f4f8;
				flex-shrink: 0;
				position: sticky;
				left: 0;
				z-index: 1;
			}
		}
	}
}
</style>
